from flask_script import Manager, Server
from app import db
from Model.Model import *
from app import app
import os

path = os.path.dirname(os.path.abspath(__file__))
manager = Manager(app)
manager.add_command('server',
                    Server(
                        host='0.0.0.0',
                        ssl_crt=path + '/server.crt',
                        ssl_key=path + '/server.key',
                        port=5050,
                    ))


@manager.shell
def make_shell_context():
    return dict(app=app, db=db, datetime=datetime, User=User, Department=Department, Doctor=Doctor,
                ReserveNotes=ReserveNotes)


if __name__ == "__main__":
    manager.run()
